package com.ufgov.pdf.entity.table;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import com.ufgov.pdf.entity.Image;
import com.ufgov.pdf.entity.Radio;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "td", propOrder = { "text", "image", "radio" })
public class Td {

	/**
	 * 是否索引列，用来在循环的时候标行序号
	 */
	@XmlAttribute(name = "is-index")
	private Boolean isIndex;

	/**
	 * 合并行数目
	 */
	@XmlAttribute(name = "rowspan")
	private String rowspan;

	/**
	 * 边框宽度
	 */
	@XmlAttribute(name = "border-width")
	private String borderWidth;

	/**
	 * 合并列数目
	 */
	@XmlAttribute(name = "colspan")
	private String colspan;

	/**
	 * 横向对齐
	 */
	@XmlAttribute(name = "align")
	private String align;

	/**
	 * 竖向对齐
	 */
	@XmlAttribute(name = "v-align")
	private String vAlign;

	// @XmlElements({ @XmlElement(name = "text"), @XmlElement(name = "image"),
	// @XmlElement(name = "radio") })
	// private List<BaseElement> children;

	@XmlElement(name = "text")
	private String text;

	@XmlElement(name = "image")
	private Image image;

	@XmlElement(name = "radio")
	private Radio radio;

	// public List<BaseElement> getChildren() {
	// return children;
	// }
	//
	// public void setChildren(List<BaseElement> children) {
	// this.children = children;
	// }

	/**
	 * 是否粗体
	 */
	@XmlAttribute(name = "weight")
	private String weight;

	public Boolean isIndex() {
		return isIndex == null ? false : isIndex;
	}

	public void setIndex(boolean isIndex) {
		this.isIndex = isIndex;
	}

	public String getBorderWidth() {
		return borderWidth;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Image getImage() {
		return image;
	}

	public void setImage(Image image) {
		this.image = image;
	}

	public void setBorderWidth(String borderWidth) {
		this.borderWidth = borderWidth;
	}

	public String getSText() {
		return text;
	}

	public void setString(String text) {
		this.text = text;
	}

	public Radio getRadio() {
		return radio;
	}

	public void setRadio(Radio radio) {
		this.radio = radio;
	}

	public String getRowspan() {
		return rowspan == null ? "1" : rowspan;
	}

	public void setRowspan(String rowspan) {
		this.rowspan = rowspan;
	}

	public String getColspan() {
		return colspan == null ? "1" : colspan;
	}

	public void setColspan(String colspan) {
		this.colspan = colspan;
	}

	public String getAlign() {
		return align;
	}

	public void setAlign(String align) {
		this.align = align;
	}

	public String getvAlign() {
		return vAlign;
	}

	public void setvAlign(String vAlign) {
		this.vAlign = vAlign;
	};

	public String getWeight() {
		return weight;
	}

	public void setWeight(String weight) {
		this.weight = weight;
	}

}
